package router

import (
	_ "LibraryManagementSys/docs"
	"LibraryManagementSys/internal/api"
	midware "LibraryManagementSys/internal/router/middleware"
	"github.com/gin-gonic/gin"
	swaggerFiles "github.com/swaggo/files"
	ginSwagger "github.com/swaggo/gin-swagger"
)

// 设置 api 接口的路由
func setupRouterAPI(r *gin.Engine) {
	userGroup := r.Group("/user")
	{
		userGroup.POST("/register", api.UserApi.Register)
		userGroup.POST("/login", api.UserApi.Login)
		userGroup.GET("/testAuth", midware.JwtAuthMiddleware(), api.UserApi.TestAuth)
	}

	// swagger 路由
	r.GET("/swagger/*any", ginSwagger.WrapHandler(swaggerFiles.Handler))
}
